<?php
/**
 * Created by PhpStorm.
 * User: sunshubo
 * Date: 2017/11/18
 * Time: 23:24
 */

class GetSchoolInfo_model extends MY_Model
{
    function get_info($body)
    {
//        $body = json_decode($body);
        $sql = /** @lang text */
            "SELECT name FROM ws_dict_school ORDER BY id ASC";

        $query = $this->db->query($sql);
        $error = $this->db->error();
        if ($query) {
            $count = $query->num_rows();
            $data = array('请选择');
            foreach ($query->result_array() as $value) {
                array_push($data, $value['name']);
            }
            return json_encode(array('result' => SUCCESS, 'data' => $data, 'count' => $count));
        }
        return json_encode(array('result' => ERROR, 'code' => $error['code']));
    }
}